package com.itqf.ipmsys.controller;


import com.itqf.ipmsys.utils.R;
import com.itqf.ipmsys.dto.ParkingRecordDto;
import com.itqf.ipmsys.service.ParkingRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 停车记录 前端控制器
 * </p>
 *
 * @author corn
 * @since 2021-09-22
 */
@CrossOrigin("*")
@RestController
@RequestMapping("/parkingrecord")
public class ParkingRecordController {

    @Autowired
    private ParkingRecordService parkingRecordService;

    /**
     * 收费记录展示
     *      1. 展示所有停车收费记录信息
     *      2. 按条件展示停车收费记录信息
     *          查询条件:停车位、车牌号、停车时间(以结束时间检索)、收费员编号、收费员、路段编号、路段地址
     *
     * @param parkingRecordDto
     * @return
     */
    @PostMapping(value = "list", consumes = "application/json;charset=utf-8")
    public Object findParkingRecordList(@RequestBody ParkingRecordDto parkingRecordDto){
        Object data = parkingRecordService.findAllParkingRecordList(parkingRecordDto);
        return R.ok(data).setCode(200);
    }

    /**
     * 停车展示
     *      1. 展示正在停车的停车信息: 车牌号、有效期、停车时长、入场时间、入口
     *      2. 展示实时的停车视频信息
     *
     * @return
     */
    @PostMapping(value = "lastthreetimes", consumes = "application/json;charset=utf-8")
    public Object showParking(){
        Object data = parkingRecordService.findRecentThreeRecord();
        return R.ok(data).setCode(200);
    }



}

